<%@page import="java.sql.Timestamp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
	SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

	String today = dft.format(new Date());
	//Date da=dft.parse(today);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>${headerTitle}</title>
<base href="<%=basePath%>/">

	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" ;/>
	<!-- IE的渲染模式 -->
	<meta name="keywords"
		content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="description"
		content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="author" content="blackshadowwalker" />
	
	<link href="css/common.css" rel="stylesheet" />
	<link href="bootstrap/3/css/bootstrap.css" rel="stylesheet" />
	
	<script src="scripts/jquery/jquery-1.7.min.js"></script>
	<script src="bootstrap/3/js/bootstrap.min.js"></script>
	<link href="bootstrap/3/css/datepicker.css" rel="stylesheet" />
	<script src="bootstrap/3/js/bootstrap-datepicker.js"></script>
	
	<script src="index/js/index.js" type="text/javascript"></script>
	<!-- jquery排序 -->
	<script src="scripts/jquery/tableSorter/scripts/JQueryPlugin/TableSort.js?t=f234324" type="text/javascript"></script>
	
	<script type="text/javascript">
			var msg = "${msg}";
			if(msg!="")
				alert(msg);
			function del(id){
				if(confirm("确定要结单吗？"))
					location.href="<%= basePath%>/${action}?method=delete&id="+id;
		}
		$(document).ready(function() {
			//tooltips
			$("[data-toggle='popover']").popover({
				animation : true,
				trigger : 'hover', //trigger: 'focus' | 'hover'
				placement : 'top',
				html : true
			});
			$(".popover-dismiss").popover({
				animation : true,
				trigger : 'hover', //trigger: 'focus' | 'hover'
				placement : 'left',
				html : true
			});
		});
		
		
		function ResetForm(){
			$("#mainForm input[name='parkOrder.poNo']").val("");
			$("#mainForm input[name='parkOrder.carNo']").val("");
			$("#mainForm input[name='parkOrder.status']").val("");
			$("#mainForm input[name='parkOrder.parkinfo.PId']").val("");
			$("#mainForm input[name='parkOrder.userinfo.realName']").val("");
		}
	</script>

	<style>
	body {
		margin-left: 10px;
		margin-top: 7px;
		width:98%;
		font-size:10px;
	}
	.form-group{
		}
		.input-group-addon{
			width:88px;
		}
	</style>

</head>
<body>
		<form id="mainForm" class="form-inline" role="form"
			method="post">
			<div class="form-group">
			<div class="input-group">
				<div class="input-group-addon"><span class="glyphicon glyphicon-user"></span>司机姓名</div>
				<input class="form-control" type="text" placeholder="司机姓名"
					style="width: 100px" name="parkOrder.userinfo.realName" />
			</div>
		</div>
		<div class="form-group">
			<div class="input-group">
				<div class="input-group-addon"><span class="glyphicon glyphicon-tasks"></span>订单号</div>
				<input class="form-control" type="text" placeholder="订单号"
					name="parkOrder.poNo" />
			</div>
		</div>
		<div class="form-group">
			<div class="input-group">
				<div class="input-group-addon"><span class="glyphicon glyphicon-road"></span>车牌号</div>
				<input class="form-control" type="text" placeholder="车牌号"
					name="parkOrder.carNo" />
			</div>
		</div>
		<div class="form-group">
			<div class="input-group">
				<div class="input-group-addon"><span class="glyphicon glyphicon-th"></span>订单状态</div>
				<select class="form-control" name="parkOrder.status">
					<option value="">--请选择订单类型--</option>
					<s:iterator value="#session.status">
						<option value="${status}" />${statusName}</option>
					</s:iterator>
				</select>
			</div>
		</div>
		<div class="form-group">
			<div class="input-group">
				<div class="input-group-addon">所属停车场</div>
				<select class="form-control" name="parkOrder.parkinfo.PId">
					<option value="">--请选择停车场--</option>
					<s:iterator value="#session.pname" var="a">
						<option value="<s:property value="#a[0]" />">
							<s:property value="#a[1]" />
						</option>
					</s:iterator>
				</select>
			</div>
		</div>
		<div class="form-group">
			<input class="btn" type="submit" value="查询" /> <input
				class="btn " type="button" value="重置" onclick="ResetForm()" />
		</div>
	</form>
			<div class="content" type="list">
			<table id="mytable" class="table  table-hover" 
				style="width:99%;min-width:700px;">
				<tr role="head">
					<th sort=true >编号</th>
					<th sort=true>订单类型</th>
					<th sort=true>用户</th>
					<th sort=true>手机号</th>
					<th sort=true>车牌</th>
					<th sort=true>收费员</th>
					<th sort=true>停车场</th>
					<th sort=true>停车时长</th>
					<th sort=true>金额</th>
					<th sort=true>预定时间</th>
					<th sort=true >离开时间</th>
					<th sort=true>状态</th>
					<th>操作</th>
				</tr>
				<s:iterator id="l" value="list" status="index">
					<s:if test='#index.odd == true'>
						<s:set name="var_class" value="'row-odd'" />
					</s:if>
					<s:else>
						<s:set name="var_class" value="'row-even'" />
					</s:else>
					<tr>
						<td><s:property value="#index.index+1"/></td>
						<td>${typeName}</td>
						<td>${userinfo.realName}</td>
						<td><span data-toggle=popover
							data-content="订单号:<font color=red>${poNo}</font>">${userinfo.phone}</span>
						</td>
						<td><s:property value="#l.carNo" />
						</td>
						<td><span data-toggle=popover
							data-content="帐号: ${parkManagerByLeaveOperatorId.userName}  手机:${parkManagerByLeaveOperatorId.phone}"
							title="收费员信息"> ${parkManagerByLeaveOperatorId.realName}</span></td>

						<td>${parkinfo.PName}</td>
						<td><s:property value="#l.reservationDuration" />小时</td>
						<td><s:property value="#l.receivableAmount" />元</td>
						<td><s:date name="#l.orderTime" format="yyyy-MM-dd hh:mm:ss" />
						</td>
						<td><s:date name="#l.leaveTime" format="yyyy-MM-dd hh:mm:ss" />
						</td>
						<td>${statusName}</td>
						<td><s:if test="#request.v>=0">
								<a class="btn btn-primary" href="${action}?method=view&id=${poId}"><span class="glyphicon glyphicon-list-alt" title="详情"
									data-toggle="popover-detail"></span></a>
							</s:if>
							<s:if test="#request.update>=0">
								<a class="btn btn-success" style="background-color:#CC66FF"
								href="${action}?method=upate?&id=${poId}" title="提醒缴费"> <span
								class="glyphicon glyphicon-bell"></span> </a>
							</s:if> <s:if test="#request.Evasion>=0">
								<a class="btn btn-success"style="background-color:#FF0088"
									href="${action}?method=Evasion&id=${poId}" title="列为逃费用户">
									<span class="glyphicon glyphicon-move"></span> </a>
							</s:if></td>
					</tr>
				</s:iterator>
			</table>
			<!-- 分页 -->
			<div name="pannal-pagecontrol">
			<div name="tablebooter" style="font-size: 13px font-family : '宋体'" align="center">
				
					共&nbsp; ${page.totalRow } &nbsp;条记录,
					共&nbsp; ${page.totalPage } &nbsp;页,
					
					&nbsp;&nbsp;
					<a class="submit"  href="${action}?page.currentPage=1&page.pageSize=${page.pageSize}" style="text-decoration:none;">
						<img src="images/page/PaginStart.gif"	border="0" />
					</a>
					&nbsp;&nbsp;
					<s:if test="page.hasPrePage==true">
						<a class="submit" href="${action}?page.currentPage=${page.prePage}&page.pageSize=${page.pageSize}" style="text-decoration:none;" 	>
							<img src="images/page/PaginLeft.gif" border="0" />
						</a>
					</s:if>
					<s:else>
						<img src="images/page/PaginLeftInactive.gif" border="0" title="已是第一页"/>
					</s:else>
					&nbsp;&nbsp;
					第:
					<select name="page.currentPage" onchange="changePage()" >
						 <script>
						 	var totalpage = "${page.totalPage}";
						 	var currentPage = "${page.currentPage}";
							for(var i=1; i<=totalpage; i++)
							{
								if(i==currentPage)
									document.write("<option value='"+i+"' selected >"+i+"</option>");
								else
									document.write("<option value='"+i+"' >"+i+"</option>");
							}
						 </script>
					</select>
					页
					&nbsp;&nbsp;
					<s:if test="page.hasNextPage==true">
						<a class="submit" href="${action}?page.currentPage=${page.nextPage}&page.pageSize=${page.pageSize}"  style="text-decoration:none;">
							<img src="images/page/PaginRight.gif" border="0" />
						</a>
					</s:if>
					<s:else>
						<img src="images/page/PaginRightInactive.gif" border="0" title="已到达最后一页" />
					</s:else>
					&nbsp;&nbsp;
					<a class="submit" href="${action}?page.currentPage=${page.totalPage}&page.pageSize=${page.pageSize}"  style="text-decoration:none;">
						<img src="images/page/PaginEnd.gif" border="0" />
					</a> 
					
					每页显示
					<select name="page.pageSize" onchange="ResetSelect();changePage();" >
						<option value="5" >5</option>				
						<option value="10" >10</option>				
						<option value="15" >15</option>				
						<option value="20" >20</option>				
						<option value="50" >50</option>				
						<option value="100" >100</option>				
						<option value="200" >200</option>				
						<option value="500" >500</option>				
					</select>
					<script>
						$("select[name='page.pageSize']").val("${page.pageSize}");
					</script>
					条记录&nbsp;
			</div>
			<script>
				function ResetSelect(){
					$("select[name='page.currentPage']").val('1');
				}
				function changePage(){
					var curPage = $("select[name='page.currentPage']").val();
					var pageSize = $("select[name='page.pageSize']").val();
					var url = "${action}?page.currentPage="+curPage+"&page.pageSize="+pageSize;
					$("#mainForm").attr("action", url);
					$("#mainForm").submit();
					
				}
			
				$(document).ready(function(){
					$("a[class='submit']").click(function (event)
					{
					    event.preventDefault();
					});
					
					$("a[class='submit']").bind("click", function(){
						var url = $(this).attr("href");
						$("#mainForm").attr("action", url);
						$("#mainForm").submit();
					});
					
					$("#mytable").sorttable({
			            ascImgUrl: "scripts/jquery/tableSorter/images/bullet_arrow_up.png",
			            descImgUrl: "scripts/jquery/tableSorter/images/bullet_arrow_down.png",
			            ascImgSize: "8px",
			            descImgSize: "8px",
			            onSorted: function (cell) {
	// 		               alert(cell.index() + " -- " + $.trim(cell.text()));
			            }
			        });
					
				});
	
			</script>
		</div>	<!-- end of 分页 -->
	</div><!-- end of list -->
</body>
</html>
